<?php
App::uses('AppModel', 'Model');
/**
 * Data Model
 *
 */
class Data extends AppModel {

/**
 * Display field
 *
 * @var string
 */
	public $displayField = 'nome';
	
	public function beforeSave($data=array()){
		if(isset($this->data[$this->alias]['data'])){
			$aux = explode(' ', $this->data[$this->alias]['data']);
			$dia = $aux[0];
			$hora = $aux[1];
			$dia = explode('/', $dia);
			$this->data[$this->alias]['data'] = "$dia[2]-$dia[1]-$dia[0] $hora";
		}
		return true;
	}
}
